home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
011-020
/
amok19
/
trackdisksupport
/
trackdisksupport.doc
< prev
next >
Wrap
Text File
|
1993-11-04
|
11KB
|
290 lines
======================================================================
Documentation for module "TrackDiskSupport" version 2.1
Author: Nicolas Benezan, Postwiesenstr. 2, 7000 Stuttgart 60, Germany
Fridtjof Siebert, Nobileweg 67, D7000 Stuttgart 40
Thanx to Frank Staudte for english translation
======================================================================
Copyright remarks
(C) Copyright 1988 by Nicolas Benezan.
The whole package (source, documentation and code) is donated to
public domain and may be copied and redistributed providing that...
* my name and this copyright remark and
* the completeness of the package remain intact,
* it's distributet for non-profit only.
Commercial use without my explicit, written permission is not
allowed.
Furthermore, all persons working for "Data Becker" or selling
products of "Data Becker" are not allowed to use this software
in any way.
Improvements and new ideas are welcome, as long as the changes are
well documented inline and in the documentation files. I´would like
to know, if you make major changes and repost it.
Contents
* Package info
* A word by the translator
* Introduction
* Description of the Proedures
Package
The whole package "TrackDiskSupport" consist of following files:
* TrackDiskSupport.doc this documentation
* TrackDiskSupport.dok german documentation
* TrackDiskSupport.def, -.mod source code
* TrackDiskSupport.sym, -.obj object code
* TrackDemo.mod, -.obj demo/test module
* InhibitDemo.mod, -obj demo/test module
A word by the translator
------------------------
I tried to translate this documentation-file into the English without
errors. At least I hope that everybody with english as his mother-tongue
is able to read this without getting stomach trouble.
I also had little problems with the German "Block", the German "Sektor", the
English "block" and the English "sector". I hope that everything is O.K.
Please refere the Rom Kernel Reference Manual Libs & Devices - chapter
"TrackDiskDevice", if you have problems.
--- Frank Staudte [fst] translator
Introduction
------------
This Software (Version 2.1) is an improvement on the on AMOK #11 released
Modul "TrackDiskSupport". It supports - like the old Version - mainly the
programming of the Amiga-TrackDisk-Device". The "trackdisk.device"
handles the reading and writing of single blocks and some additional
funktions like turning the motor on or off or seeking around.
New on this Version is that you have access to other "block-built"
devices like a harddisk or some ramdisks. Also new in this Version is a
function which locks a physical device for your task, so that other tasks
or dos have absolutely no access to it. On the Workbench-Screen this
drive is indicated as >dfx:BUSY<.
Description of the Procedures
-----------------------------
OpenDiskDevice()
----------------
Before you can start working with a Disk-Device you must open it via
OpenDiskDevice(). Simply hand the Procedure the Name of the device (for
example "DF0", "DH1" or "JH0") over. Be sure NOT to have a colon after
the name. Names of Volumes like "Workbench" or logical devices which are
assigned like "SYS" or "LIBS" are NOT allowed. Devices such as "CON", "RAW"
or "PRT" which are not based on blocks are inadmissible, too. Remember that
some RamDisks are bock-built (like "CARD") some are not (For Example "RAM"
OR "VD0"). OpenDiskDevice() trades an an opaque Type called "DiskUnit"
which is needed for further procedures (like "Seek") and an error number (0
-> no error during opening!). The error number is defined in the Modul
"TrackDisk", which is spread with your compiler. (only for M2Amiga-users!)
They range from "notSpecified=20" to "postReset=35". Important is the error
"badDriveType=33" which means, that this drive is not connected or is no
block-built device (see above). Important: You can only close a device or
access to it, if its opening was successful. (error = 0)
CloseDiskDevice()
-----------------
Please close your devices if you are finished with it. In case of an error
or at the end of your program, TrackDiskSupport will close all your Drives
automaticly. But don't be too lazy with it, or you might loose some of your
data.
The following procedures are allmost the same as they are implemented in
"TrackDiskSupport V1.0" on AMOK #11. They handle the direkt programming
of the trackdisk.devices (or other like "harddisk.device")
(...)
All procedures work with logical block numbers. which range - for example
on a 3.5" disk - from 0 to 1759 (two sides, 160 tracks, 11 sectors per
track). Partitions on a harddisk are handled correctly. If you want to
access the first block of a hard disk partition (which starts at cylinder
100, for example), simply specify block number 0 (and not 100 x Sectors per
Cylinder).
(...) (This part in the German documentation can be deleted in the
English, because it handles some explanations of names, which are a
little confusing for Germans, but not for English. I try to
explain tracks and surfaces and so on here in English myself: Each 3.5"
Floppy Disk on the Amiga has: 2 SIDES, because the Amiga has two HEADS to
access the to SURFACES of the disk. A disk has 160 TRACKS (80 CYLINDERS, 2
SURFACES), each TRACK contains 11 SECTORS. So there are 1760 SECTORS
alltogether. Confused?)
GetDeviceInfo()
---------------
With this procedure you can get all the information about device. This
information is collected in a structure (RECORD) as follows:
devName: Name of the device (f.e. "trackdisk.device")
devUnit: Number of the drive (f.e. 2 for DF2!)
devFlags this is needed for the call of Exec.OpenDevice.
blockLen: *Size of one sector (block) in Byte
trackLen: *Size of one track in Byte
cylinderLen: Size of the cylinder in Byte
numBlocks: *Number of all sectors (blocks) on a Disk or partition of a
harddisk. All secotor-numbers must be in the range of
[0..numerBlocks-1]!
offset: Start of the harddisk-partition (internal).
disk: Pointer to some other information. (See below)
handler: The FileHandle-Process assiged to this device.
-- The following is for the multi-mega-specialists (see "DosSupport")
disk^.lenght: Number of valid entries in the table. (usualy 11 or 16.
ATTENTION: if "11" are all entries starting at
BufMemType are invalid!
disk^.blockSize: LONGWORD's per sector (block)
disk^.origin: Number of the first sector (block). (always 0 (zero))
disk^.surfaces: Number of surfaces or heads.
disk^.secBlock: sectors per logical block (unused, always 1)
(sectors and blocks are synonyms, on the Amiga)
disk^.numSecs: sectors per track
disk^.resBlocks: Number of reserved blocks (2 for the Boot-blocks)
disk^.prealloc: Preallocation-factor
disk^.interleave: Interleave-factor
disk^.lowCyl: First cylinder of the partition
disk^.highCyl: Last cylinder of the partition
disk^.numBuffers: Number of Cache-Buffers.
disk^.BufMemType: Memory attributes for cache buffers
disk^.reserved1: ???, most of the time 7FFFFFFFH
disk^.reserved2: ???, most -2
disk^.reserved3: ???, most 0
disk^.diskType: Label of the disk. (usually "DOS")
BlockNumber()
-------------
With this procedure you can calculate the logical block number simply by
the cylinder surface and sector Number.
IMPORTANT: Remember, that you recive the number beginning at the start of
your partition, and not at the physical start of your
harddisk.
GetDiskChange()
---------------
This procedure is equal to the "changeNum" command of the
"trackdisk.device" (tdd) and returns the number of diskchanges since the
system startup. Do this, if you Read or Write to your device. With this you
can avoid reading/writing on a (wrong) disk, which has been changed.
ChangeState()
-------------
This procedure is equal to the "changeState" command of the
"tdd", and returns if a disk is inserted in the device.
ProtStatus()
------------
Equal to "protStatus" in the "tdd". It returns wether you can
write onto a disk or if it is write-protected.
Motor()
-------
Equal to the "motor" command in the "tdd". It let's you turnig
on/off the motor of a device. You need this command only for turning off
the motor, because the tdd turns on the motor itself by
reading or writing on the disk. Turnig off the motor on a harddisk is
impossible. By doing so you move the heads of the harddisk into their
"park-position", if the harddisk supportes this feature. (Try and turn on
the motor of your RamDisk. Great fun, hä!)
Seek()
------
Equal to "seek" of the "tdd". You can use this to move the
heads, but you don't need this. It is done by the Read/Write-Proceudres
automatically. "Seek" could be used to save some time in copy programs for
example.
ReadBlock()
-----------
Equal to "extRead" in "tdd". Use this to read blocks of your disk. You need
a blocknumber, the number of blocks to be read, and the address of a
buffer. The buffer must be longword-aglined and should be in CHIP-Memory.
(On other disk types test the BuffMemType. (See GetDeviceInfo). You also
need the DiskChange-number (GetDiskChange), which should be stored in a
variable (for multiple use).
WriteBlock()
------------
Equal to "extWrite" in "tdd". The parameters are the same as ReadBlock().
So please use the above for reference.
Update()
--------
Equal to "update" in "tdd". The TrackDiskDevice provides a quicker use by
saving data on the disk only if the buffer for one track is full. Update
stores the Buffer on disk, even if it is not compleltly full. Use this,
if you do not access the disk next time, to be sure, that all data is
saved. (In case of a system-crash all data in the buffer would be lost!)
FormatTrack()
-------------
Equal to "format" in TDD. It formats a track and writes data to it at the
same time.
Clear()
-------
Equal to "clear" in TDD. This is contrary to UpDate(). It clears the
buffer and prevents it from being written to disk.
GetDriveType() & GetNumTracks()
-------------------------------
This procedures are only included to be compatible to the old version of
TrackDiskSupport V1.0.
DO NOT USE THEM. Use "GetDeviceInfo()" instead, because some (old)
harddisk-handler do not support this. This leads to some wounderfull
system.crashes. (Try it, if you want)
InhibitDrive()
--------------
If you need a drive for exclusive use (while copying or so), you can lock
it with this procedure. FileSystem and Dos can not access to a drive which
has been locked. But if somebody accesses the drive direct via Hardware,
you have no chance to stop him. (Everybody doing this is to be killed. Or
is supposed to programm Basic for one year!) Accessing a inhibited drive
via CLI, the CLI returns a "No Dos Disk", Workbench says: "DFx:BUSY".
IMPORTANT: The procedures to install the DiskChange-Interrupt are not
---------- implemented, because of an error in the operating-system.
They do not work!!!!!
Demonstration/Tests:
--------------------
TrackDemo: This prints information on a drive specified by its name.
InhibitDemo: This locks a Drive specified by its name for 4 secs.
(DFX:Busy or DHX:Busy or JHX:Busy...)
Quit the demos by typing <RETURN> without anything else.